package finalproject.controller.commands;

import finalproject.model.player.Player;
import finalproject.view.StringManager;

/***
 * the drop command
 * @author Buisson Kevin
 *
 */
public class DropCommand extends Command {

	/**
	 * 
	 * @param player the player issuing the command
	 * @param args the command argument
	 */
	public DropCommand(Player player, String[] args)
	{
		super(player, args);
	}

	@Override
	public boolean process()
	{
		// No item to drop
		if (!hasSecondWord())
			StringManager.outPut("noitemdrop");
		// Drop item
		else if (getPlayer().dropItem(getSecondWord()))
		{
			StringManager.outPut("itemdroped");
			return true;
		}
		
		// Can't drop
		StringManager.outPut("cantdropit");
		return false;
	}
}
